package com.liudadan.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


@RequestMapping("jsp")
@Controller
public class JspController {

    @GetMapping("jumpIndex")
    public String jumpIndex(){
        System.out.println("JspController.jumpIndex");
        return "index";
    }

    @GetMapping("jumpShwo")
    public String jumpShwo(){
        System.out.println("JspController.jumpShwo");
        return "show";
    }
    @RequestMapping("/redirect-demo")
    public String redirectDemo() {
        // 重定向到 /demo 路径
        return "redirect:/jsp/target";
    }

    @RequestMapping("/forward-demo")
    public String forwardDemo() {
        // 转发到 /demo 路径
        return "forward:/jsp/target";
    }
    @ResponseBody
    @RequestMapping("/target")
    public String forTarget(){
        return "target";
    }


//注意： 转发和重定向到项目下资源路径都是相同，都不需要添加项目根路径！填写项目下路径即可！
}
